package com.flick.order.ctrl;

import com.flick.annotation.AutoResult;
import com.flick.common.CommonPage;
import com.flick.order.services.OrderService;
import com.flick.vo.payment.OrderVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "订单相关")
@RequestMapping("/api/order")
@Slf4j
@AutoResult
public class OrderCtrl {
    @Autowired
    OrderService service;

    @ApiOperation("测试列表")
    @GetMapping("/list")
    public List<OrderVo> list(){
        return service.list();
    }

    @ApiOperation("测试分页")
    @GetMapping("/page")
    public CommonPage<OrderVo> page(@ApiParam(value="page",defaultValue = "1",required = true,example = "1") @RequestParam Integer page,
                                    @ApiParam(value="size",defaultValue = "10",required = true,example = "10") @RequestParam Integer size){
        return service.page(page,size);
    }
}
